<!-- begin {fieldName} -->
<td>
<?php
$tableName = $foreignFields["{fieldName}"];
$className = mymodel::getClassName($tableName);
$obj_{fieldName} = new $className();

$val = $currentList[$i]['{fieldName}'];
$find = $obj_{fieldName}->find($val);


if(!$find){
    echo "<a href='".strtolower($className) .",list'>{$val}</a>";
}else {
    $tmpDesc = '';
    $tmpVal = '';
    $tmpKeys = array_keys($obj_{fieldName}->arr);
    $tmpDescF = $tmpKeys[1];
    $tmpPrimaryKey = $obj_{fieldName}->key();
    ?>
    <a href="<?php echo strtolower($className) . ',list,' . $tmpPrimaryKey . ',' . $obj_{fieldName}->$tmpPrimaryKey; ?>"
       target="_self"><?php
        if(!$obj_{fieldName}->$tmpDescF){echo "<font color='gray'>$val</font>"; }else{
            if(in_array($tmpDescF,$obj_{fieldName}->imageField())) echo "<image style='height:120px;' src=".FRONT_URL.$obj_{fieldName}->$tmpDescF." />";
            else echo $obj_{fieldName}->$tmpDescF;
        }
        ?></a>
    <?php
}
    ?>
</td>
<!-- end  {fieldName} -->